package com.ruoyi.xh.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.page.TablePageDataInfo;
import com.ruoyi.common.core.domain.CommentResult;
import com.ruoyi.xh.domain.XhRegionNum;
import com.ruoyi.xh.service.IXhRegionNumService;

/**
 * 区域入库数Controller
 *
 * @author songjw
 * @date 2024-12-13
 */
@Api(tags = "区域入库数Controller",value = "区域入库数Controller")
@RestController
@RequestMapping("/xh/regionNum")
public class XhRegionNumController extends BaseController {

    @Autowired
    private IXhRegionNumService xhRegionNumService;

    /**
     * 查询区域入库数列表
     */
    @PreAuthorize("@ss.hasPermi('xh:regionNum:list')")
    @GetMapping("/list")
    @ApiOperation("查询区域入库数列表")
    public TablePageDataInfo<XhRegionNum> list(XhRegionNum xhRegionNum) {
        return TablePageDataInfo.success(xhRegionNumService.selectXhRegionNumList(xhRegionNum));
    }

    /**
     * 获取区域入库数详细信息
     */
    @PreAuthorize("@ss.hasPermi('xh:regionNum:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取区域入库数详细信息")
    public CommentResult<XhRegionNum> getInfo(@PathVariable("id") Long id) {
        return CommentResult.success(xhRegionNumService.selectXhRegionNumById(id));
    }

    /**
     * 新增区域入库数
     */
    @PreAuthorize("@ss.hasPermi('xh:regionNum:add')")
    @Log(title = "区域入库数", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation("新增区域入库数")
    public CommentResult<XhRegionNum> add(@RequestBody XhRegionNum xhRegionNum) {
            xhRegionNumService.insertXhRegionNum(xhRegionNum);
        return CommentResult.success();
    }

    /**
     * 修改区域入库数
     */
    @PreAuthorize("@ss.hasPermi('xh:regionNum:edit')")
    @Log(title = "区域入库数", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation("修改区域入库数")
    public CommentResult<XhRegionNum> edit(@RequestBody XhRegionNum xhRegionNum) {
            xhRegionNumService.updateXhRegionNum(xhRegionNum);
        return CommentResult.success();
    }

    /**
     * 删除区域入库数
     */
    @PreAuthorize("@ss.hasPermi('xh:regionNum:remove')")
    @Log(title = "区域入库数", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    @ApiOperation("删除区域入库数")
    public CommentResult<XhRegionNum> remove(@PathVariable Long[] ids) {
            xhRegionNumService.deleteXhRegionNumByIds(ids);
        return CommentResult.success();
    }
}
